function Brush(config){
	config = config || {};
	this.curLine = config.line || "round";
	this.curWidth = config.width || 5;
	this.curColor = config.color || "#cb3594";
	this.records = new Array();

	this.addRecord = function(x, y, isDrag){
		this.records.push({
			"x": x,
			"y": y,
			"isDrag": isDrag,
			"line": this.curLine,
			"width": this.curWidth,
			"color": this.curColor 
		});
	}

	this.redraw = function(context){
		for(var i=0;i < this.records.length; i++) {
			context.lineJoin = this.records[i].line;
			context.lineWidth = this.records[i].width;
			context.strokeStyle = this.records[i].color;	

			context.beginPath();
			if(this.records[i].isDrag && i) {
				context.moveTo(this.records[i-1].x, this.records[i-1].y);
			}else{
				context.moveTo(this.records[i].x-1, this.records[i].y);
			}
			context.lineTo(this.records[i].x, this.records[i].y);
			context.closePath();
			context.stroke();
		}
	};

	this.setColor = function(color){
		this.curColor = color;
	};
	this.setWidth = function(width){
		this.curWidth = width;
	};
	this.setLine = function(line){
		this.curLine = line;
	};
}
